
//
//  loginViewController.m
//  LT
//
//  Created by dllo on 16/5/25.
//  Copyright © 2016年 dllo. All rights reserved.
//
//
#import "loginViewController.h"
//#import "loginView.h"
//#import "registerViewController.h"
//#import "UMSocial.h"

@interface loginViewController ()
//@property(nonatomic,strong)UITableView *loginV;
//
//@property(nonatomic,strong)UIButton *registerButton;
//@property(nonatomic,strong)UIButton *loginButton;
@end

@implementation loginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    self.view.backgroundColor = [UIColor whiteColor];
//    
//    loginView *view1 = [[loginView alloc]initWithFrame:CGRectMake(50, 60, 300, 50)];
//    view1.myLabel.text = @"用户名";
//    view1.myText.placeholder = @"请输入用户名";
//    [self.view addSubview:view1];
//    
//    loginView *view2 = [[loginView alloc]initWithFrame:CGRectMake(50, 130, 300, 50)];
//    view2.myLabel.text = @"密码";
//    view2.myText.placeholder = @"请输入密码";
//    [self.view addSubview:view2];
// 
//    
//    self.registerButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.registerButton.frame = CGRectMake(80, 300, 100, 50);
//    self.registerButton.backgroundColor = [UIColor cyanColor];
//    [self.registerButton setTitle:@"注册" forState:UIControlStateNormal];
//    [self.view addSubview:self.registerButton];
//    [self.registerButton addTarget:self action:@selector(buttonAction1:) forControlEvents:UIControlEventTouchUpInside];
//    
//    self.loginButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.loginButton.frame = CGRectMake(220, 300, 100, 50);
//    self.loginButton.backgroundColor = [UIColor cyanColor];
//    [self.loginButton setTitle:@"登录" forState:UIControlStateNormal];
//    [self.view addSubview:self.loginButton];
//    [self.loginButton addTarget:self action:@selector(buttonAction2:) forControlEvents:UIControlEventTouchUpInside];
//    
//    
//    //使用微信,QQ,微博登录
//    //微信按钮
//    UIButton *weixinButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    weixinButton.frame = CGRectMake(80, 600, 60, 60);
//    weixinButton.backgroundColor = [UIColor whiteColor];
//    [weixinButton setBackgroundImage:[UIImage imageNamed:@"weixin"] forState:UIControlStateNormal];
//    weixinButton.layer.masksToBounds = YES;
//    weixinButton.layer.cornerRadius = 30;
//    [self.view addSubview:weixinButton];
//    [weixinButton addTarget:self action:@selector(buttonActionWeixin:) forControlEvents:UIControlEventTouchUpInside];
//    
//    //QQ
//    UIButton *QQButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    QQButton.frame = CGRectMake(160, 600, 60, 60);
//    QQButton.backgroundColor = [UIColor whiteColor];
//    [QQButton setBackgroundImage:[UIImage imageNamed:@"QQ"] forState:UIControlStateNormal];
//    QQButton.layer.masksToBounds = YES;
//    QQButton.layer.cornerRadius = 30;
//    [self.view addSubview:QQButton];
//    [QQButton addTarget:self action:@selector(buttonActionQQ:) forControlEvents:UIControlEventTouchUpInside];
//    
//    //微博
//    UIButton *weiboButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    weiboButton.frame = CGRectMake(240, 600, 60, 60);
//    weiboButton.backgroundColor = [UIColor whiteColor];
//    [weiboButton setBackgroundImage:[UIImage imageNamed:@"weibo"] forState:UIControlStateNormal];
//    weiboButton.layer.masksToBounds = YES;
//    weiboButton.layer.cornerRadius = 30;
//    [self.view addSubview:weiboButton];
//    [weiboButton addTarget:self action:@selector(buttonActionWeibo:) forControlEvents:UIControlEventTouchUpInside];
//    
//    
    
}

//微信按钮
//-(void)buttonActionWeixin:(UIButton *)button{
////用Alert添加
//    UIAlertController *alertWeixin = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否使用微信登录" preferredStyle:UIAlertControllerStyleAlert];
//[alertWeixin addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//    NSLog(@"回到这个界面");
//    
//}]];
//
//    [alertWeixin addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//        
//        NSLog(@"使用微信登录");
//        
//        } ]];
//                                      
//        
//                                      
//                                      
//                                      
//                                      
//    
//    [self presentViewController:alertWeixin animated:YES completion:^{
//        
//        
//    }];
//
//}

//QQ
//-(void)buttonActionQQ:(UIButton *)button{
//    //用Alert
//    UIAlertController *alertQQ = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否使用QQ登录" preferredStyle:UIAlertControllerStyleAlert];
//    [alertQQ addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//        
//        NSLog(@"回到原来界面");
//        
//    }]];
//    [alertQQ addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//        
//        NSLog(@"使用QQ登录");
//    }]];
//    
//    [self presentViewController:alertQQ animated:YES completion:^{
//        
//        
//    }];
//    
//}

//微博
//-(void)buttonActionWeibo:(UIButton *)button{
////用Alert
//
//    UIAlertController *alertWeibo = [UIAlertController alertControllerWithTitle:@"提示" message:@"是否使用微博登录" preferredStyle:UIAlertControllerStyleAlert];
//    [alertWeibo addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//        
//        NSLog(@"回到原来界面");
//        
//    }]];
//    [alertWeibo addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
//        
//        NSLog(@"使用微博登录");//微博可以登录,需要写
//        
//        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//        //建立一个新浪微博的用户
//        UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToSina];
//        
//        snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){
//            //          获取微博用户名、uid、token等
//            if(response.responseCode == UMSResponseCodeSuccess){
//                
//               // NSDictionary *dict = [UMSocialAccountManager socialAccountDictionary];
//                UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToSina];
//                NSLog(@"username is %@, uid is %@, token is %@ url is %@",snsAccount.userName,snsAccount.usid,snsAccount.accessToken,snsAccount.iconURL);
//                [defaults setObject:snsAccount.userName forKey:@"userName"];
//                [defaults setObject:snsAccount.iconURL forKey:@"userImage"];
//                
//               
//                
//                //这步我们需要把login界面穿过来的头像和图片给user里面
////[self.loginButton setImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:snsAccount.iconURL]]] forState:UIControlStateNormal];
//           [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"loginStatus"];//1
//                
//                [self.navigationController popViewControllerAnimated:YES];
//                
//            //获取accestoken以及新浪用户信息，得到的数据在回调Block对象形参respone的data属性
//                [[UMSocialDataService defaultDataService]requestSnsInformation:UMShareToSina completion:^(UMSocialResponseEntity *response) {
//                    NSLog(@"SnsInformation is %@",response.data);
//                    
//                }];
//            }
//        });
//        
//       
//    }]];
//    
//    [self presentViewController:alertWeibo animated:YES completion:^{
//        
//        
//    }];
//    
////
//}
//
//
//-(void)buttonAction1:(UIButton *)button{
////2.点击跳转注册界面
//    registerViewController *registerVC = [[registerViewController alloc]init];
//   
//    [self.navigationController pushViewController:registerVC animated:YES];
//    
//
//}
//
//-(void)buttonAction2:(UIButton *)button{
////点击跳转以及界面
//    
//
//    
//    
//
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
